import socket
import time
import json

#此指令内容为机械臂各关节运行至零位，速度百分之五十，交融半径为0；
point1 = '{"command":"movej","joint":[0,0,0,0,0,0],"v":50,"r":0}\r\n'

client1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#服务端ip为192.168.1.18
host1 = '192.168.1.18'
#服务端 端口为8080
port1 = 8080
#创建客户端并连接至指定服务端
client1.connect((host1, port1))
time.sleep(1)
#发送point1至服务端，编码格式为UTF-8
client1.send(point1.encode('utf-8'))
#定义data1的变量接收服务端返回值
data1 = client1.recv(1024).decode()
time.sleep(10)
print(data1)
#关闭Socket连接
client1.close()




